import java.util.LinkedList;
import java.util.Queue;

public class num225_1 {
    Queue<Integer> t1 = new LinkedList<>();

    public void push(int x) {
     int size = t1.size();
     t1.offer(x);
        for (int i = 0; i < size; i++) {
            t1.offer(t1.poll());
        }
    }

    public int pop() {
        return t1.poll();
    }

    public int top() {
        return t1.peek();
    }

    public boolean empty() {
       return t1.isEmpty();
    }
}
